<?php
namespace App\HttpController;

class Index extends Base {

    function index() {
        $shopId = $this->request()->getRequestParam('shop_id');
        $isShop = $this->request()->getRequestParam('is_shop');
        $userId = $this->request()->getRequestParam('user_id');
        $userName = $this->request()->getRequestParam('username');
        $avatar = $this->request()->getRequestParam('avatar');

        $hostName = $this->cfgValue('WEBSOCKET_HOST','ws://127.0.0.1:9501');

        $this->render('index', [
            'server'    => $hostName,
            'shopId'    => empty($shopId) ? 0 : $shopId,
            'isShop'    => intval($isShop) > 0 ? 1 : 0,
            'userId'    => intval($userId) > 0 ? intval($userId) : 0,
            'userName'  => isset($userName) ? htmlspecialchars($userName) : 0,
            'avatar'    => isset($avatar) ? $avatar : '',
            'type'      => 1,
        ]);
    }
}